package com.flejay.dreamrecruiter.tools;

import java.util.List;

import org.apache.commons.lang3.StringUtils;

/**
 * Param control utility class
 * 
 * @author Woody
 *
 */
public final class ParamControllerTool {

	private ParamControllerTool(){
		super();
	}
	
	/**
	 * Jete une exception non verifie si le parametre est vide
	 * 
	 * @param param
	 * @param paramName
	 */
	public static void controlString(String param, String paramName){
		if (StringUtils.isEmpty(param)){
			StringBuffer buffer = new StringBuffer().append(paramName).append(" could not be null or empty");
			throw new IllegalArgumentException(buffer.toString());
		}
	}

	/**
	 * Jete une exception non verifie si la liste est vide ou null
	 * @param cvs
	 * @param string
	 */
	public static void controlList(List<?> cvs, String string) {
		if (cvs == null || cvs.size() == 0){
			StringBuffer buffer = new StringBuffer().append(string).append(" could not be null or empty");
			throw new IllegalArgumentException(buffer.toString());
		}
	}
	
}
